<!--友情链接-->
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>个人中心</title>
    <link rel="stylesheet" href="../css/personal_center.css">
    <link rel="stylesheet" href="../css/common.css">
    <link rel="stylesheet" href="../css/style_zj.css">
    <link rel="stylesheet" href="../layui/css/layui.css">
    <link rel="stylesheet" href="../fonts/iconfont.css">
    <!--<link rel="stylesheet" href="../less/laypage.css">-->
    <style>
        .active1{
            color: #fb6a30!important;
        }

        .mask-comm{
            position: fixed;
            top: 0;
            width: 100%;
            height: 100%;
            background-color: #000;
            opacity: 0.6;
            z-index: 10;
        }
        .offer-mod-content{
            position: fixed;
            width: 800px;
            height: 500px;
            background-color: #fff;
            top: 20%;
            left: 50%;
            margin-left: -400px;
            z-index: 20;
        }
    </style>
</head>
<body>
<div class="detail-offer-modal hide">
    <div class="mask-comm"></div>
    <div class="offer-mod-content"></div>
</div>

<!--<div id="header_01_html">
    <iframe id="header_01" src="head_01.html" frameborder="0"></iframe>
</div>-->
<div class="content-box">
    <!--<div id="left_tab_html">
        <iframe id="left_tab" src="left_tab.html?x=2&y=2" frameborder="0"></iframe>
    </div>-->
    <div class="right-box layui-form" id="vue-box" v-cloak>
        <div class="content-admin">
            <div class="title-toggle">
                <div class="item active">我的询价</div>
            </div>
            <div>
                <div class="table-list">
                    <table>
                        <thead>
                        <tr>
                            <th>产品信息标题</th>
                            <th>品类</th>
                            <th class="js-allCheck width_130">
                                图片
                            </th>

                            <th class="width_170">询价时间</th>
                            <th class="width_100">状态</th>
                            <th class="width_120">操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        <tr v-for="(item,index) in pagList">
                            <td>{{item.name}}</td>
                            <td>{{item.commodityType}}</td>
                            <td class="js-onlyCheck p-r">
                                <img :src="imgBaseUrl + item.picUrl" alt="" class="img-sty"></td>
                            </td>
                            <td>{{item.crtTime}}</td>
                            <td>{{item.state==0?'上架':'下架'}}</td>
                            <td>
                                <div class="colo-blue cur-p" @click="lookOfferList(item.id)">查看详情</div>
                                <div class="colo-blue cur-p" @click="operation(item.state,item.id)">{{item.state==0?'关闭询价':'打开询价'}}</div>
                            </td>
                        </tr>
                        </tbody>
                    </table>
                    <div id="test1" class="text-r"></div>
                </div>
            </div>
        </div>
    </div>
</div>
<!--<div>
    <iframe src="footer-record.html" style="width: 100%;border: none;height:60px;"></iframe>
</div>-->
<script src="../js/config.js"></script>
<script>
    var postData = {
        limit:10,
        offset:1,
        type:'',
        name:'',
        state:'',
        originId:'',
        startPrice:'',
        endPrice:'',
        customType:'',
    }

    var app = new Vue({
        el: '#vue-box',
        data: {
            pagList:'',
            imgBaseUrl: imgBaseUrl,
        },
        mounted:function(){
            this.getPage();
        },
        updated:function () {

        },
        methods:{
            getPage:function(){
                var that = this;
                get_ajaxPage("/sys/storeCommodity/getMyBuyPage", postData, function (data) {
                    data.data.forEach(function (item) {
                        item.picUrl = item.picUrl.split(",")[0];
                    })
                    that.pagList = data.data;
                    layui.use('laypage', function(){
                        var laypage = layui.laypage;
                        //执行一个laypage实例
                        laypage.render({
                            elem: 'test1'
                            ,count: data.count //数据总数，从服务端得到
                            ,limit:postData.limit
                            ,jump: function(obj, first){
                                //obj包含了当前分页的所有参数，比如：
                                console.log(obj.curr); //得到当前页，以便向服务端请求对应页的数据。
                                console.log(obj.limit); //得到每页显示的条数

                                //首次不执行
                                if(!first){
                                    //do something
                                    postData.offset = obj.curr;
                                    get_ajaxPage("/sys/storeCommodity/getMyBuyPage", postData, function (data) {
                                        data.data.forEach(function (item) {
                                            item.picUrl = item.picUrl.split(",")[0];
                                        })
                                        that.pagList = data.data;
                                    })
                                }
                            }
                        });
                    });
                })



            },
            operation:function(state,id){
                if(state==0){
                    get_ajax("/sys/storeCommodity/del", {ids:id}, function (data) {
                        layer.msg('操作成功！');
                        app.getPage();
                    })
                }else {
                    get_ajax("/sys/storeCommodity/grounding", {ids:id}, function (data) {
                        layer.msg('操作成功！');
                        app.getPage();
                    })
                }



            },
            lookOfferList:function(id){
                window.location.href='lookOfeerList.html?id='+id;
            }


        }
    });





















</script>
</body>
</html>
